package com.gitee.wsl.doc.prosemirror.plugin

/**
 * This is the type passed to the [`Plugin`](#state.Plugin)
 * constructor. It provides a definition for a plugin.
 */
abstract class PluginSpec<PluginState> {

    /**
     * Allows a plugin to define a [state field](#state.StateField), an
     * extra slot in the state object in which it can keep its own data.
     */
    open val state: StateField<PluginState>? = null

    /**
     * Can be used to make this a keyed plugin. You can have only one
     * plugin with a given key in a given state, but it is possible to
     * access the plugin's configuration and state through the key,
     * without having access to the plugin instance object.
     */
    open val key: PluginKey<PluginState>? = null

    /**
     * When the plugin needs to interact with the editor view, or
     * set something up in the DOM, use this field. The function
     * will be called when the plugin's state is associated with an
     * editor view.
     */
//    val view: ((view: EditorView) -> PluginView)?,

    /**
     * Additional properties are allowed on plugin specs, which can be
     * read via [`Plugin.spec`](#state.Plugin.spec).
     */
    open val additionalProps: Map<String, Any> = mapOf()
}